package com.ylsk.check.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ylsk.check.domain.vo.ReportApprLogVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ylsk.common.annotation.Log;
import com.ylsk.common.core.controller.BaseController;
import com.ylsk.common.core.domain.AjaxResult;
import com.ylsk.common.enums.BusinessType;
import com.ylsk.check.domain.ReportApprLog;
import com.ylsk.check.service.IReportApprLogService;
import com.ylsk.common.utils.poi.ExcelUtil;
import com.ylsk.common.core.page.TableDataInfo;

/**
 * 报备信息审批日志Controller
 *
 * @author yangsy
 * @date 2023-12-15
 */
@RestController
@RequestMapping("/check/reportApprLog")
public class ReportApprLogController extends BaseController
{
    @Autowired
    private IReportApprLogService reportApprLogService;

    /**
     * 查询报备信息审批日志列表
     */
    @PreAuthorize("@ss.hasPermi('check:reportApprLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(ReportApprLog reportApprLog)
    {
        startPage();
        List<ReportApprLogVO> list = reportApprLogService.selectReportApprLogList(reportApprLog);
        return getDataTable(list);
    }

    /**
     * 导出报备信息审批日志列表
     */
    @PreAuthorize("@ss.hasPermi('check:reportApprLog:export')")
    @Log(title = "报备信息审批日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ReportApprLog reportApprLog)
    {
        List<ReportApprLogVO> list = reportApprLogService.selectReportApprLogList(reportApprLog);
        ExcelUtil<ReportApprLogVO> util = new ExcelUtil<ReportApprLogVO>(ReportApprLogVO.class);
        util.exportExcel(response, list, "报备信息审批日志数据");
    }

    /**
     * 获取报备信息审批日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('check:reportApprLog:query')")
    @GetMapping(value = "/{reportApprLogId}")
    public AjaxResult getInfo(@PathVariable("reportApprLogId") Long reportApprLogId)
    {
        return success(reportApprLogService.selectReportApprLogByReportApprLogId(reportApprLogId));
    }

    /**
     * 新增报备信息审批日志
     */
//    @PreAuthorize("@ss.hasPermi('check:reportApprLog:add')")
    @Log(title = "报备信息审批日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ReportApprLog reportApprLog)
    {
        return toAjax(reportApprLogService.insertReportApprLog(reportApprLog));
    }

    /**
     * 修改报备信息审批日志
     */
    @PreAuthorize("@ss.hasPermi('check:reportApprLog:edit')")
    @Log(title = "报备信息审批日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ReportApprLog reportApprLog)
    {
        return toAjax(reportApprLogService.updateReportApprLog(reportApprLog));
    }

    /**
     * 删除报备信息审批日志
     */
    @PreAuthorize("@ss.hasPermi('check:reportApprLog:remove')")
    @Log(title = "报备信息审批日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reportApprLogIds}")
    public AjaxResult remove(@PathVariable Long[] reportApprLogIds)
    {
        return toAjax(reportApprLogService.deleteReportApprLogByReportApprLogIds(reportApprLogIds));
    }

    /**
     * 查询报备信息审批日志不分页列表
     */
    @GetMapping("/selectList")
    public AjaxResult selectList(ReportApprLog reportApprLog)
    {
        List<ReportApprLogVO> list = reportApprLogService.selectReportApprLogList(reportApprLog);
        return success(list);
    }
}
